package action.seller;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.apache.struts2.ServletActionContext;

import service.SellerService;
import util.Utilities;
import vo.OrderListVO;
import vo.SellerVO;

public class SellerSearchPriceAction {
	private SellerService seller_service;
	private SellerVO selvo;
	private ArrayList<OrderListVO> list;
	private Object endDate;
	private Object startDate;
	private int sumPrice;
	public SellerService getSellerService() {
		return seller_service;
	}
	public void setSellerService(SellerService seller_Service) {
		seller_service = seller_Service;
	}
	public SellerVO getSelvo() {
		return selvo;
	}
	public void setSelvo(SellerVO selvo) {
		this.selvo = selvo;
	}
	
	public ArrayList<OrderListVO> getList() {
		return list;
	}
	public void setList(ArrayList<OrderListVO> list) {
		this.list = list;
	}
	
	public int getSumPrice() {
		return sumPrice;
	}
	public void setSumPrice(int sumPrice) {
		this.sumPrice = sumPrice;
	}
	public String execute(){
		
		HttpServletRequest request = ServletActionContext.getRequest();
		HttpSession session = request.getSession();
		String member_id = (String)session.getAttribute("member_id");
		try{
			list = seller_service.selectTotalPrice(member_id);
			sumPrice = seller_service.selectTotalPrice2(member_id);
			
			Iterator itr = list.iterator();
			while (itr.hasNext()) {
				OrderListVO ovo = (OrderListVO)itr.next();
				ovo.setResult_time(Utilities.getDateTimeDot(ovo.getResult_time()));
			}
		}catch(Exception e){	
			e.printStackTrace();
		}
		
		return "success";
	}
}
